package com.iob.coin.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: GuoXinyuan
 * @Date: 2021/6/6
 * 绘制实体
 */
@Data
//@AllArgsConstructor
@NoArgsConstructor
public class Node implements Cloneable{

    public Node(String uri, String label_ZH, String label_EN, Node type) {
        this.uri = uri;
        this.label_ZH = label_ZH;
        this.label_EN = label_EN;
        this.type = type;
    }

    private int id; //只有被加入KG时id才会产生意义

    private String uri;

    private String label_ZH;

    private String label_EN;

    private int typeId;

    @JsonIgnore
    private Node type;

    @Override
    public int hashCode() {
        return uri.hashCode();
    }

    @Override
    public boolean equals(Object o){
        if(o instanceof Node){
            return ((Node) o).getUri().equals(this.uri);
        }
        else return false;
    }

    @Override
    public Node clone() {
        return new Node(uri,label_ZH,label_EN,type);
    }

}
